package com.alibaba.middleware.hsf.guide.serverfilter;


import com.taobao.hsf.annotation.Name;
import com.taobao.hsf.annotation.Optional;
import com.taobao.hsf.invocation.Invocation;
import com.taobao.hsf.invocation.InvocationHandler;
import com.taobao.hsf.invocation.RPCResult;
import com.taobao.hsf.invocation.filter.ServerFilter;
import com.taobao.hsf.util.concurrent.ListenableFuture;

/**
 * Created by sixie.xyn on 2016/1/15.
 */
@Optional
@Name("HSFOptionalServerFilter")
public class HSFOptionalServerFilter implements ServerFilter {
    public ListenableFuture<RPCResult> invoke(InvocationHandler invocationHandler,
                                              Invocation invocation) throws Throwable {
        System.out.println("#### HSFOptionalServerFilter intercept request");
        return invocationHandler.invoke(invocation);
    }

    public void onResponse(Invocation invocation, RPCResult rpcResult) {
        System.out.println("#### HSFOptionalServerFilter intercept response");
    }


}
